/*
class Quaternion {
    constructor(c,i,j,k){
        this.c = c;
        this.i = i;
        this.j = j;
        this.k = k;
    }

    mutiply(q){
        return new Quaternion(
            this.c * q.c - this.i * q.i - this.j * q.j - this.k * q.k,
            this.c * q.i + this.i * q.c + this.j * q.k - this.k * q.j,
            this.c * q.j - this.i * q.k + this.j * q.c + this.k * q.i,
            this.c * q.k + this.i * q.j - this.j * q.i + this.k * q.c
        )
    }
}
*/
class Quaternion_str {
    constructor(c, i, j, k) {
        this.c = c;
        this.i = i;
        this.j = j;
        this.k = k;
    }

    /**
     * 
     * @param {Quaternion_str} q 
     * @returns Array<Array<String>(4)>(4)
     */
    mutiply_array(q) {
        return [
            [['+', this.c, q.c], ['-', this.i, q.i], ['-', this.j, q.j], ['-', this.k, q.k]],
            [['+', this.c, q.i], ['+', this.i, q.c], ['+', this.j, q.k], ['-', this.k, q.j]],
            [['+', this.c, q.j], ['-', this.i, q.k], ['+', this.j, q.c], ['+', this.k, q.i]],
            [['+', this.c, q.k], ['+', this.i, q.j], ['-', this.j, q.i], ['+', this.k, q.c]]
        ]
    }
}
/*
   0  3  1  4  2  5  n
0  0  0  3  3  1  1
1  0  0  3  3  1  1
2  0  0  3  3  1  1
3  4  4  2  2  5  5
4  4  4  2  2  5  5
5  4  4  2  2  5  5
p
*/
const Cors = [
    [0, 0, 3, 3, 1, 1],
    [0, 0, 3, 3, 1, 1],
    [0, 0, 3, 3, 1, 1],
    [4, 4, 2, 2, 5, 5],
    [4, 4, 2, 2, 5, 5],
    [4, 4, 2, 2, 5, 5],
];
const Hexs = [], Muts = [], Eqls = [];
for (let m = 0; m <= 5; m++) {
    Hexs.push(new Quaternion_str(`c${m}`, `i${m}`, `j${m}`, `k${m}`));
}
for (let m = 0; m <= 5; m++) {
    for (let n = 0; n <= 5; n++) {
        // Muts.push(Hexs[m].mutiply_array(Hexs[n]));
        Muts.push(
            new Quaternion_str(...
                Hexs[m].mutiply_array(Hexs[n]).map(
                    e => e.map(
                        d => d.sort().join('')
                    ).join('')
                )
            )
        );
        Eqls.push(Hexs[Cors[m][n]]);
    }
}

const cijk = ['c','i','j','k']
const Equations = [];
for (let x = 0; x < 36; x++) {
    for(let l of cijk){
        Equations.push(`${Muts[x][l]} == ${Eqls[x][l]}`);
    }
}

for (const e of Equations) {
    console.log(e)
}